<?php
Yii::import('Cms.components.widgets.BaseCmsWidget');
class PureHtml extends BaseCmsWidget
{
    protected $textId;
    
    public function run(){
        $texts = $this->getActiveDataProvider()->getData();
        if (count($texts)){
            $this->textId = $texts[0]->id;
            return $texts[0]->content;
        }
    }
    
    // this widget does not have layout
    public function getSelectedLayout() {
        return null;
    }
    
    // return the url to edit text content
    public function getEditUrl($params = array()){
        $params['page_widget_id'] = $this->pageWidgetId;
        $params['id'] = $this->dataSettings['params'][':id'];
        
        return url('/Cms/widgets/pureHtml/update', $params);
    }
}